package problemLCR173;

//LCR 173.点名
//https://leetcode.cn/problems/que-shi-de-shu-zi-lcof/

class Solution {
    public int takeAttendance(int[] records) {
        int n = records.length;
        int left = 0, right = n-1;
        while(left < right) {
            int mid = left + (right-left)/2;
            if(records[mid] == mid) {
                left = mid+1;
            }else {
                right = mid;
            }
        }
        if(records[left] == left) return left + 1;
        return left;
    }
}